package com.cx.base.day08_字符串;//package com.cx.base.day08_字符串;

import java.util.Scanner;

/**
 * @Author: robert.song
 * @Date: Created in 2022/5/16
 */
public class StringDemo2 {
    public static void main(String[] args) {

//        String str1 = "test";
        char[] chars1 = {'a'};
        char[] chars2 = chars1;
        chars2[0] = 'c';
        System.out.println(chars1);
        String str = new String("哈哈");
        System.out.println(str.intern() == str);
        char c = 'a';
        Scanner scanner = new Scanner(System.in);
        String str2 = scanner.nextLine();
        String str3 = str2.intern();
        System.out.println(str3 == str2);
        Scanner scanner1 = new Scanner(System.in);
        String str21 = scanner1.nextLine();
        String str31 = str21.intern();
        System.out.println(str21 == str2);
        System.out.println(str21 == str31);
        System.out.println(str3 == str31);
        String str4 = "test2";
        String str5 = new String(str4 + str3);
        System.out.println(str5.intern() == str5);
//        System.out.println(str1==str3);
        String str6 = new StringBuilder().append("append1").append("append2").toString();
        String str7 = new String("A" + "B");
        String str8 = new String("1") + new String("2");
    }
}
